﻿<dialog:DialogBase x:Class="Daytimer.Controls.CategoryEditor"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:dialog="clr-namespace:Daytimer.Dialogs;assembly=Daytimer.Dialogs"
		xmlns:database="clr-namespace:Daytimer.DatabaseHelpers;assembly=Daytimer.DatabaseHelpers" Title="Categories"
		Height="300" Width="500" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" MinWidth="190"
		MinHeight="170">
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<ListBox x:Name="listBox" Margin="15,15,15,0" BorderThickness="0"
				ScrollViewer.HorizontalScrollBarVisibility="Disabled">
			<ListBox.Resources>
				<Style TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItemStyle}">
					<Setter Property="HorizontalContentAlignment" Value="Stretch" />
					<Setter Property="Padding" Value="10,5" />
					<EventSetter Event="MouseDoubleClick" Handler="ListBoxItem_MouseDoubleClick" />
				</Style>
				<DataTemplate DataType="{x:Type database:Category}">
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="*" />
							<ColumnDefinition Width="Auto" />
						</Grid.ColumnDefinitions>
						<Grid Width="14" Height="14">
							<Grid.Background>
								<SolidColorBrush Color="{Binding Color}" />
							</Grid.Background>
							<Border BorderBrush="#40000000" BorderThickness="1" />
						</Grid>
						<TextBlock Grid.Column="1" Text="{Binding Name}" TextTrimming="CharacterEllipsis"
								Margin="10,0,0,0" />
						<Image Grid.Column="2" Visibility="{Binding ReadOnlyVisibility}"
								Source="pack://application:,,,/Daytimer.Images;component/Images/lock_sml.png"
								Stretch="None" VerticalAlignment="Center" Margin="10,0,0,0"
								ToolTip="This category is read-only" />
					</Grid>
				</DataTemplate>
			</ListBox.Resources>
		</ListBox>
		<Grid Background="#FFF1F1F1" Grid.Row="2" Margin="0,20,0,0">
			<Button x:Name="newButton" HorizontalAlignment="Left" VerticalAlignment="Center" Content="_New" Margin="15"
					Click="newButton_Click" />
			<Button HorizontalAlignment="Right" VerticalAlignment="Center" Content="_Close" Margin="15" IsCancel="True" />
		</Grid>
	</Grid>
</dialog:DialogBase>
